FROM frolvlad/alpine-oraclejdk8:slim
MAINTAINER yuanguorui0528@gmail.com

# 指定参数

ARG PROFILES mock

# 环境变量
ENV WORK_PATH /opt/jar/
ENV APP_NAME  @project.build.finalName@.@project.packaging@
ENV APP_VERSION  @project.version@
ENV JAVA_OPTS ""

# test
RUN echo $PROFILES

# consul
wget https://releases.hashicorp.com/consul/0.8.3/consul_0.8.3_linux_amd64.zip?_ga=2.43974245.1514509904.1496503156-1830820084.1489113738 -O /tmp/consul.zip

cd /bin/ && unzip /tmp/consul.zip

# create state and configuration directories
mkdir -p {/srv/consul,/etc/consul.d}


# COPY
COPY $APP_NAME $WORK_PATH/

# WORKDIR
WORKDIR $WORK_PATH

# 端口
EXPOSE 80

# 挂载日志盘
VOLUME /var/log/jar/

# 更新文件时间
RUN sh -c 'touch $WORK_PATH/$APP_NAME'

RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisord.conf
CMD ["/usr/bin/supervisord"]